package com.macro.mall.portal.component;

import com.macro.mall.portal.service.activityImpl.ActivityImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 取消订单消息的处理者
 *
 * @author zhouboyu
 * @date 2018/9/14
 */
@Component
@RabbitListener(queues = "quyum.group.buy.cancel")
public class CancelGroupBuyReceiver {
    private static Logger LOGGER =LoggerFactory.getLogger(CancelGroupBuyReceiver.class);
    @Autowired
    private ActivityImpl activity;
    @RabbitHandler
    public void handle(Long groupBuyId){
        try {
            this.activity.cancelGroupBuyOrders(groupBuyId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        LOGGER.info("process groupBuyId:{}",groupBuyId);
        LOGGER.info("取消团购---------------mq",groupBuyId);
    }
}
